<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script>
  import util from '@/libs/util.js';
  export default {
    name: 'App',
    data () {
      return {};
    },
    mounted () {
      var _this = this;
      var protocol = window.location.protocol;
      var host = 'http://';
      if (protocol.indexOf('https') > -1) {
        host = 'https://';
      }
      // ajax 请求的url
      var ajaxUrl = util.ajaxUrl;
      var ajaxUrlArr = ajaxUrl.split('://');
      if (ajaxUrlArr[1]) {
        util.ajaxUrl = host + ajaxUrlArr[1];
      }
      // 富文本编辑器上传图片的url
      var DecoupledEditor_uploadUrl = util.DecoupledEditor_uploadUrl;
      var DecoupledEditor_uploadUrlArr = DecoupledEditor_uploadUrl.split('://');
      if (DecoupledEditor_uploadUrlArr[1]) {
        util.DecoupledEditor_uploadUrl = host + DecoupledEditor_uploadUrlArr[1];
      }
      // 下载app.apk地址
      var app_apk_url = util.app_apk_url;
      var app_apk_urlArr = app_apk_url.split('://');
      if (app_apk_urlArr[1]) {
        util.app_apk_url = host + app_apk_urlArr[1];
      }

      var clientWidth = document.documentElement.clientWidth;
      var clientHeight = document.documentElement.clientHeight;
      var DrawerWidth = clientWidth - 250;
      if (DrawerWidth < 567 && clientWidth >= 576) {
        DrawerWidth = 576;
      } else if (DrawerWidth < 567 && clientWidth < 576) {
        DrawerWidth = clientWidth;
      }
      util.constant.DrawerWidth = DrawerWidth;
      util.constant.WindowWidth = clientWidth;
      util.constant.WindowHeight = clientHeight;

      //全局配置:距离顶部距离，自动关闭时间
      _this.$Message.config({
        top: 50,
        duration: 5
      });
      _this.$Notice.config({
        top: 50,
        duration: 5
      });

    },
    beforeDestroy () {

    },
    methods: {}
  };
</script>

<style lang="less">
  .size {
    width: 100%;
    height: 100%;
  }

  html, body {
    .size;
    overflow: hidden;
    margin: 0;
    padding: 0;
  }

  #app {
    .size;
  }
</style>
